import React from 'react';
import {withRouter, NavLink} from 'react-router-dom';

import {Links} from '@assets/config/global.js';
import Tools from '@untils/tools.jsx';

import HeaderBanner from '@assets/images/banner.jpg';

import './scss/index.scss';

const partymap = {
    name: '党建地图',
    path: '/home'
};

class Header extends React.Component {
    constructor(props) {
        super(props);
        this.state = {};
        this.setCallback = Tools.setCallback.bind(this);
    }

    render() {
        const concatLinks = [partymap, ...Links];
        return (
            <div className="header-content">
                <img src={HeaderBanner} alt="" className="header-img"/>
                <ul className="nav-list">
                    {
                        concatLinks.map((item, index) => {
                            return (
                                <li className="list-item" key={index}>
                                    <NavLink className='nav-link-item' to={item.path}
                                        activeClassName="selected"
                                    >{item.name}</NavLink>
                                </li>
                            )
                        })
                    }
                </ul>
            </div>
        )
    }
}

export default withRouter(Header);